UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '54tDxHFitFTecfZY9xB2+u0KNlVIHJI6y1nN6j57MBI=' 
WHERE 
  key_id = '0c9f2a875e584b441e3caaec4fa8d87e39a80381d4d602fb3ea6c4a5369970da' 
  AND (
    token = '54tDxHFitFTecfZY9xB2+u0KNlVIHJI6y1nN6j57MBI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030