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

Query time 0.00031