UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5XwHIXtrRaaoqPZ2VpIjeRZXG7HpydSLgfTgAgCbSMY=' 
WHERE 
  key_id = 'a55e1155c8170ec06621c0b4fc0654ad0b558c8a00c0c4cd31902607b89bd075' 
  AND (
    token = '5XwHIXtrRaaoqPZ2VpIjeRZXG7HpydSLgfTgAgCbSMY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037