UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w2MBiS4+GiNMt25S8lHCp/cc253s8+x4liwMYzz5pTY=' 
WHERE 
  key_id = '51ca026e391340c3dc500e9daa5727a7dfffb9f7decd376a94bed7cc716948f0' 
  AND (
    token = 'w2MBiS4+GiNMt25S8lHCp/cc253s8+x4liwMYzz5pTY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033