UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TnvyxvURBMlSQn8gaCF1jETlpm6s8RF3aB7VbO/lvwk=' 
WHERE 
  key_id = '0e9030d4ac8614e602c322f9619ff9c469d58f50543e80dd80cca666a23d2bf0' 
  AND (
    token = 'TnvyxvURBMlSQn8gaCF1jETlpm6s8RF3aB7VbO/lvwk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053