UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7g+/xndf7HeE540oFI1C0Sup9x6PNAPqU0g3rB2kxNI=' 
WHERE 
  key_id = 'a10bd0604369c3598d70ff0770558b04429665389567275370f367eea7e60b2c' 
  AND (
    token = '7g+/xndf7HeE540oFI1C0Sup9x6PNAPqU0g3rB2kxNI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029