UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ehdcPwGEdtfhKu7T3r31Y2gYVIggTyWI8/4OqipgK9M=' 
WHERE 
  key_id = '87dfd549fcbf2525138addd6a83c63045e28eb8a4f86bbb9226aa7030dcd7a7c' 
  AND (
    token = 'ehdcPwGEdtfhKu7T3r31Y2gYVIggTyWI8/4OqipgK9M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035