UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GHA2nRLCDYEDc102hWjWiv2foak2VvD1lA31qJXRouU=' 
WHERE 
  key_id = '04887365e97c1ee9a3dafd23fc218f4408dae32816797859d3f4f4f945ba1459' 
  AND (
    token = 'GHA2nRLCDYEDc102hWjWiv2foak2VvD1lA31qJXRouU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00086