UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pxhj8bSX901Tr1naG5St0S6fLccAIZM9ECGp8hi9Spw=' 
WHERE 
  key_id = '11ee9536bc73fdca7bc3d0e59e178ed72b0fd8ce03b5ea013b941ffd4c757fa1' 
  AND (
    token = 'pxhj8bSX901Tr1naG5St0S6fLccAIZM9ECGp8hi9Spw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042