UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wQZoLhmhA6sV19d7Pe8tavULm+Yp9Jsxd7ewl2Q+Q90=' 
WHERE 
  key_id = '46055a6f66b4d6be773f9baf5a97b8133e4a1b2b7666861b170996a7a6b11e68' 
  AND (
    token = 'wQZoLhmhA6sV19d7Pe8tavULm+Yp9Jsxd7ewl2Q+Q90=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028