UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l0P5NEoIhMKIzxfVg5txyKZo1a/imalAJeIKPbkTYhA=' 
WHERE 
  key_id = 'b499021eda0e591e23e74d16db382b307b2a090f2c93044594e8a0ccadb9064f' 
  AND (
    token = 'l0P5NEoIhMKIzxfVg5txyKZo1a/imalAJeIKPbkTYhA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042