UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O+jl2RN19Mhweog9g7K31qcwVVvbZXDsYy9HqOeFTmc=' 
WHERE 
  key_id = '1efbc339f802f6191224e94aa8d88d5c99c0e25e16a6bede497892ef611b30a4' 
  AND (
    token = 'O+jl2RN19Mhweog9g7K31qcwVVvbZXDsYy9HqOeFTmc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033