UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b5SO988j3pY3fghmh9sqxtmGeuxvSkIagD5a8nHCzBo=' 
WHERE 
  key_id = '321f781f5272bedaa296f747dfa1078cbcf50dbb61cef9d02ec88853b049d9cd' 
  AND (
    token = 'b5SO988j3pY3fghmh9sqxtmGeuxvSkIagD5a8nHCzBo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00082