UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sOlWLjoJst1YBVeVdZSGAh2UFA8r2OBmTLM9Ow5leqM=' 
WHERE 
  key_id = 'bf6a19ff0c42e778504a155d2ca6aac8fa4dbed969907949fbd59b1d48330ff5' 
  AND (
    token = 'sOlWLjoJst1YBVeVdZSGAh2UFA8r2OBmTLM9Ow5leqM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028