UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M5f6Dvhooxtoi7asgLlzzXHRff5ZI4CBRsuhe2S0lxc=' 
WHERE 
  key_id = '7d804ccf3b0fbeb5881731e9aa5551620253c7237a51024a84179124f36e4967' 
  AND (
    token = 'M5f6Dvhooxtoi7asgLlzzXHRff5ZI4CBRsuhe2S0lxc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032