UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YsdjhMwB4jDnxBN+vCD1EhPLKt4dX1eN6quusNrxsCM=' 
WHERE 
  key_id = '9a23de2c03cd4409bb42713422075e9b1c6401d407eb42863aa1521aef6adb1d' 
  AND (
    token = 'YsdjhMwB4jDnxBN+vCD1EhPLKt4dX1eN6quusNrxsCM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029