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

Query time 0.00074