UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j8wPigHTzyZ02N4FBFVtKwWQ5Z97KETpZqoT9Ht0X8M=' 
WHERE 
  key_id = '1c2c4a3df2208c61154ae24ad6cf5e3cde02abdedee35d2d215d06ae8eeedb8b' 
  AND (
    token = 'j8wPigHTzyZ02N4FBFVtKwWQ5Z97KETpZqoT9Ht0X8M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032