UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ToQAm4/0hNYcsKuDxb7HgaIeW2GMkdg0lpk1P0Lffsk=' 
WHERE 
  key_id = '7030999ab12f638a8c6c8fc5c101a732f9e51087242175b6b681de2220241668' 
  AND (
    token = 'ToQAm4/0hNYcsKuDxb7HgaIeW2GMkdg0lpk1P0Lffsk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020