UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '06K5MxS9CNj58eP2imz3qP6EYXhfkiZ12xCwLjvyeFs=' 
WHERE 
  key_id = '0562fe007a4b4198ab2cac9c573772d8e3c470f6a99e9373d9a8c76580114295' 
  AND (
    token = '06K5MxS9CNj58eP2imz3qP6EYXhfkiZ12xCwLjvyeFs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026