UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h7Ytp76kadE3zhsGeOw+6/rNdfJi7IRRdheKKc3s+8w=' 
WHERE 
  key_id = '80db01113abb23fdc806e071bc0228832fa7c177493f12a46627b8831a9365f4' 
  AND (
    token = 'h7Ytp76kadE3zhsGeOw+6/rNdfJi7IRRdheKKc3s+8w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046