UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aly0F0k9Az/MmvFAibqT4VKtlgx5nMoexU1tiuxylzM=' 
WHERE 
  key_id = '9f685b76f633035fbc5d77303a469e74bcc495202207b7c69e882b700e41a477' 
  AND (
    token = 'aly0F0k9Az/MmvFAibqT4VKtlgx5nMoexU1tiuxylzM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029