UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BEGe2aHMs4g+1Jzv/7lcfDTKhuLM3nU/WCh3mO0SAzA=' 
WHERE 
  key_id = 'ac9128333d84d8b6ededc1362aaf35e0f5d8c3fa4a1c6828fbb71b0aa5b09211' 
  AND (
    token = 'BEGe2aHMs4g+1Jzv/7lcfDTKhuLM3nU/WCh3mO0SAzA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032