UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xGgI04V+Lf3uNTDhtuVqN1shd/+l3RWxxNT0HuP9eVE=' 
WHERE 
  key_id = '71b782495f27ce70e7785e0794087c7fd117563640a36a80691416e8c522d78a' 
  AND (
    token = 'xGgI04V+Lf3uNTDhtuVqN1shd/+l3RWxxNT0HuP9eVE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022