UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '66Q7aOGb38xFh4GmMzC/Uspz88igr5OaPBobvmw4HAM=' 
WHERE 
  key_id = 'e8bdf753c9043136fbf2964e887d9e5f823049443c411417f6ed580559357e78' 
  AND (
    token = '66Q7aOGb38xFh4GmMzC/Uspz88igr5OaPBobvmw4HAM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030