UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QYC2BmxsmJ/C8vfoxwuILnGHhdWsNpSuXRc8AZO+2A4=' 
WHERE 
  key_id = '17affe90373e2d47d78b96327e641c3d0acf65fdefe6701799c42dcfc3c89086' 
  AND (
    token = 'QYC2BmxsmJ/C8vfoxwuILnGHhdWsNpSuXRc8AZO+2A4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00078