UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RO4y7wfTkjEW4ukTsesZcIoVkxUMmH5SbgSkArRdQEw=' 
WHERE 
  key_id = 'e34662158f1b26ab60d15f5181f8497bace24430e5d43737296286b16de643f1' 
  AND (
    token = 'RO4y7wfTkjEW4ukTsesZcIoVkxUMmH5SbgSkArRdQEw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017