UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'laRmkv2P8uhYYTSMB4FwCPlNlg4Up6JUCnjZnJSBUeQ=' 
WHERE 
  key_id = '64a0c81ca20c4a1f174646db4ec3bd7b6293a6788ce44b3c7c4d19e04811038f' 
  AND (
    token = 'laRmkv2P8uhYYTSMB4FwCPlNlg4Up6JUCnjZnJSBUeQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028