UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vOtTP/qjFHHzLgxmx8Yqjv+7WwP7skWDMnkK50Es+JY=' 
WHERE 
  key_id = '6c160ac95e234509f79d349695e3da33149f188b98421639336fcbcb14719fbb' 
  AND (
    token = 'vOtTP/qjFHHzLgxmx8Yqjv+7WwP7skWDMnkK50Es+JY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031