UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZNUaVAvIllt3Lg8bURm0SVzB9pFnAdiiA3AHdUbZg3Y=' 
WHERE 
  key_id = 'd633dd77538f663516f442c5e2cfe3b064c92983f24d25c85d6dfa69fcf8da8d' 
  AND (
    token = 'ZNUaVAvIllt3Lg8bURm0SVzB9pFnAdiiA3AHdUbZg3Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028