UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RWnFIPmY/BTGfZgwd33vnQnkPCVtZl5reUvbQXvbUIU=' 
WHERE 
  key_id = 'c0ac4b58e2e6b796c2c8b56fb74aa1c8464dd365f0e9de2c93697dc438c9d6af' 
  AND (
    token = 'RWnFIPmY/BTGfZgwd33vnQnkPCVtZl5reUvbQXvbUIU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034