UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YWE6Vf5O2GLJ1s6hVUbqUrKf3pujqtOxB+2LvJizbro=' 
WHERE 
  key_id = '543afca08ce908179dc791143225b7c5a6e6b11cc65989f2e64bd3e319778983' 
  AND (
    token = 'YWE6Vf5O2GLJ1s6hVUbqUrKf3pujqtOxB+2LvJizbro=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051