UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oSThrKovH3SuU0mVfXH3Hhn50V8Ny6gOInzt7Npmcdw=' 
WHERE 
  key_id = 'c140c248914f242094609923c175f5b831a0fe928967c47a0bf2b2eb731088c3' 
  AND (
    token = 'oSThrKovH3SuU0mVfXH3Hhn50V8Ny6gOInzt7Npmcdw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016