UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CrTaOfVhk7lM96CFg7UdrbUq3Z+V+tW2Kb3GUQHJVAc=' 
WHERE 
  key_id = 'f13741e8e4da216ed6bc0d2f2d8cfff5161c12349636550f7bdcd4603c8ab19d' 
  AND (
    token = 'CrTaOfVhk7lM96CFg7UdrbUq3Z+V+tW2Kb3GUQHJVAc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029